package com.mall.db.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.mall.db.domain.JobAndTrigger;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface JobDao extends BaseMapper<JobAndTrigger> {

    @Select({"<script> " +
            " select " +
            "d.JOB_NAME,d.JOB_GROUP,d.JOB_CLASS_NAME class_name, " +
            "t.TRIGGER_GROUP,t.TRIGGER_NAME,t.trigger_state state, " +
            "c.CRON_EXPRESSION corn,c.TIME_ZONE_ID time_zone " +
            "from qrtz_job_details d " +
            "join  qrtz_triggers t " +
            "join qrtz_cron_triggers c " +
            "on d.JOB_NAME = t.JOB_NAME and t.TRIGGER_NAME = c.TRIGGER_NAME " +
            "and t.TRIGGER_GROUP = c.TRIGGER_GROUP where 1=1 \n" +
            "<if test='jobName!=null'> and d.job_name = #{jobName}</if> \n" +
            "</script>" })
    List<JobAndTrigger> find(JobAndTrigger jt);

}
